package com.java.interview.i设计模式.单例模式;


import com.java.crazy.base.BaseClass;

public class SingleTest extends BaseClass {
    public static void main(String[] args) {
        int times = 10_0000_0000;

        long timeLongOld = System.currentTimeMillis();
        logi("timeLongOld",   timeLongOld + "ms");
        for (int i = 0; i < times; i++) {
            SingletonDemo singletonDemo = SingletonDemo.getInstance();
        }
        long  timeLongCurrnet = System.currentTimeMillis();
        logi("double-check", timeLongCurrnet - timeLongOld + "ms");
        timeLongOld = timeLongCurrnet;
        for (int i = 0; i < times; i++) {
            SingletonDemo singletonDemo = SingletonDemo.getInstanceStatic();
        }
        timeLongCurrnet = System.currentTimeMillis();
        logi("static-class", timeLongCurrnet - timeLongOld + "ms");
        SingletonDemo.Singleton.INSTANCE.whateverMethod();
        SingletonDemo.Singleton.INSTANCE.whateverMe();
    }
}
